package com.jp.knowledge.my.activity;

import com.jiayen.util.ToasUtil;
import com.jp.knowledge.R;
import com.jp.knowledge.my.resources.OrganizeJoinRes;

/**
 * 加入公司
 */
public class JoinCompanyActivity extends JoinOrganizeCommActivity {
    @Override
    protected void itemClick(int index) {
        intent.putExtra(OrganizeJoinRes.REQUEST_CODE, OrganizeJoinRes.COMPANY_INDEX);
        switch (index) {
            case 0:
                intent.setClass(JoinCompanyActivity.this, SearchListActivity.class);
                intent.putExtra(OrganizeJoinRes.TITLE, getString(OrganizeJoinRes.COMPANY_ITEM_TITLES[0]));
                startActivityForResult(intent, index, null);
                break;
            case 1:
                if(this.itemDetails.get(0).getText().toString().trim().length() == 0) {
                    ToasUtil.toast(JoinCompanyActivity.this, R.string.toast_choose_company_first);
                    break;
                }
                intent.setClass(JoinCompanyActivity.this, DepartmentActivity.class);
                intent.putExtra(OrganizeJoinRes.TITLE, getString(OrganizeJoinRes.COMPANY_ITEM_TITLES[1]));
                startActivityForResult(intent, index, null);
                break;
            case 2:
                intent.setClass(JoinCompanyActivity.this, PositionActivity.class);
                intent.putExtra(OrganizeJoinRes.POSITION, itemDetails.get(2).getText().toString());
                startActivityForResult(intent, index, null);
                break;
            default:
                return;
        }
    }
}
